﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Mechanics.Transactions {
    import Classes.*;
    import Transactions.*;
    import Modules.crew.*;

    public class TMechanicAction extends TFarmTransaction {

        public static const PERFORM_MECHANIC_ACTION:String = "performMechanicAction";
        public static const PERFORM_NEIGHBOR_MECHANIC_ACTION:String = "performNeighborMechanicAction";

        protected var m_ownerObject:MechanicMapResource;
        protected var m_mechanicType:String;
        protected var m_callingGameMode:String;
        protected var m_params:Object;
        protected var m_method:String;

        public function TMechanicAction(_arg1:MechanicMapResource, _arg2:String, _arg3:String, _arg4:Object=null){
            this.m_ownerObject = _arg1;
            this.m_mechanicType = _arg2;
            this.m_callingGameMode = _arg3;
            if (_arg4){
                this.m_params = _arg4;
            } else {
                this.m_params = {};
            };
            this.m_method = PERFORM_MECHANIC_ACTION;
            if (Global.isVisiting()){
                this.m_method = PERFORM_NEIGHBOR_MECHANIC_ACTION;
                this.m_params["neighbor"] = Global.getVisiting();
            };
            RollCallManager.debugSample("TMechanicAction", "isVisiting", (Global.isVisiting()) ? "true" : "false");
            super();
        }
        public function get ownerObject():MechanicMapResource{
            return (this.m_ownerObject);
        }
        override public function perform():void{
            signedCall(("GameMechanicService." + this.m_method), this.m_ownerObject.getId(), this.m_mechanicType, this.m_callingGameMode, this.m_params);
        }
        public function getParams():Object{
            return (this.m_params);
        }

    }
}//package Mechanics.Transactions 
